// 抄表状态：meterReadingManagement.js

const state = {
    flag: true,  // 控制显示抄表页面还是采集器页面
    centerId: null,  // 查看集中器下的采集器，保存集中器Id
    communityId: null,  // 查看小区下的表，保存小区Id
    getDeviceListMsg: { dialog: false },  // 查看采集器下的表、查看所有表、查看失败表
    getDayCommand: { dialog: false },  // 查看今日临时命令、查看今日失败命令
    getCommMeterListMsg: {dialog: false}, // 查看小区所有表、失败表
};
const getters = {
    // 承载变化的flag
    showFlag(state) {
        return state.flag;
    },
    showCenterId(state) {
        return state.centerId;
    },
    showCommunityId(state) {
        return state.communityId;
    },
    showDeviceList(state) {
        return state.getDeviceListMsg;
    },
    showDayCommand(state) {
        return state.getDayCommand;
    },
    showCommMeterList(state) {
        return state.getCommMeterListMsg;
    },
};
const mutations = {
    // 变换 flag 的值
    changeFlag(state, item) {
        state.flag = item;
    },
    changeCenterId(state, item) {
        state.centerId = item;
    },
    changeCommunityId(state, item) {
        state.communityId = item;
    },
    changeDeviceList(state, item) {
        state.getDeviceListMsg = item;
    },
    changeDayCommand(state, item) {
        state.getDayCommand = item;
    },
    changeCommMeterList(state, item) {
        state.getCommMeterListMsg = item;
    },
 };
const actions = {
    // 触发 mutations 里面的 changeFlag, 传入数据形参 item
    commitFlag(context, item) { 
        context.commit('changeFlag', item);
    },
    commitCenterId(context, item) {
        context.commit('changeCenterId', item);
    },
    commitCommunityId(context, item) {
        context.commit('changeCommunityId', item);
    },
    commitDeviceList(context, item) {
        context.commit('changeDeviceList', item);
    },
    commitDayCommand(context, item) {
        context.commit('changeDayCommand', item);
    },
    commitCommMeterList(context, item) {
        context.commit('changeCommMeterList', item);
    },
};
export default {
    // 用于在全局引用此文件里的方法时标识这一个的文件名
    namespaced: true,
    state,
    getters,
    mutations,
    actions
}